package com.qimu.saiyou.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qimu.saiyou.model.dto.team.TeamJoinRequest;
import com.qimu.saiyou.model.dto.team.TeamKickOutRequest;
import com.qimu.saiyou.model.dto.team.TeamQueryRequest;
import com.qimu.saiyou.model.dto.team.TeamTransferOfIdentityRequest;
import com.qimu.saiyou.model.entity.Team;
import com.qimu.saiyou.model.entity.User;
import com.qimu.saiyou.model.vo.TeamVO;

import javax.servlet.http.HttpServletRequest;

/**
 * @author: FeiXiang
 * @description 针对表【team(队伍)】的数据库操作Service
 * @createDate 2024-02-24 14:30:00
 */
public interface TeamService extends IService<Team> {
    /**
     * 校验
     *
     * @param team
     * @param add
     */
    void validTeam(Team team, boolean add);

    /**
     * 获取查询条件
     *
     * @param teamQueryRequest
     * @return
     */
    QueryWrapper<Team> getQueryWrapper(TeamQueryRequest teamQueryRequest);

    /**
     * @param joinTeam  加入团队
     * @param loginUser 登录用户
     * @return {@link boolean}
     */
    boolean joinTeam(TeamJoinRequest joinTeam, User loginUser);

    /**
     * 退出团队
     *
     * @param teamId  团队id
     * @param request 要求
     * @return boolean
     */
    boolean quitTeam(Long teamId, HttpServletRequest request);

    /**
     * 获取帖子封装
     *
     * @param team
     * @param request
     * @return
     */
    TeamVO getTeamVO(Team team, HttpServletRequest request);

    TeamVO getTeamVO(Team team);

    /**
     * 分页获取帖子封装
     *
     * @param teamPage
     * @param request
     * @return
     */
    Page<TeamVO> getTeamVOPage(Page<Team> teamPage, HttpServletRequest request);

    /**
     * 团队身份转移
     *
     * @param teamTransferOfIdentityRequest 团队身份转移请求
     * @param request                       要求
     * @return boolean
     */
    boolean teamAdminTransferOfIdentity(TeamTransferOfIdentityRequest teamTransferOfIdentityRequest, HttpServletRequest request);

    boolean teamCancelCaptain(TeamTransferOfIdentityRequest teamTransferOfIdentityRequest, HttpServletRequest request);

    /**
     * 踢出队
     *
     * @param teamKickOutRequest 退出团队请求
     * @param request            要求
     * @return boolean
     */
    boolean kickOutTeam(TeamKickOutRequest teamKickOutRequest, HttpServletRequest request);
}
